Ext.define('appmod.view.role.maintain.Dashboard', {
    extend: 'Ext.grid.Panel',
    alias: 'widget.roledashboard',
    margins:"5 5 0 5",
	requires:[
		'Ext.ux.form.SearchField'
	],
    region : 'center',
    title: '业务角色管理',

    initComponent: function() {
        var me = this;

        Ext.applyIf(me, {
            columns: [
                {
                    xtype: 'gridcolumn',
                    text: '业务或系统角色',
                    columns: [
                        {
                            xtype: 'gridcolumn',
							width:150,
                            dataIndex: 'name',
                            text: '角色名称',
							sortable:true
                        },
                        {
                            xtype: 'gridcolumn',
                            width:150,
							dataIndex: 'code',
                            text: '角色代码'
                        }
                    ]
                },
                {
                    xtype: 'gridcolumn',
                    dataIndex: 'parent',
					width:150,
                    text: '父角色(或无)'
                },
                {
                    xtype: 'gridcolumn',
                    dataIndex: 'role',
                    text: '系统角色'
                },
                {
                    xtype: 'booleancolumn',
                    dataIndex: 'disabled',
                    text: '禁用',
					width:60,
					trueText:'是',
					falseText:'否'
                },				
                {
                    xtype: 'datecolumn',
                    dataIndex: 'updatedDate',
                    text: '更新日期',
					format:'Y-m-d'
                },
                {
                    xtype: 'gridcolumn',
                    dataIndex: 'updatedUser',
                    text: '更新人'
                }	
            ],
            viewConfig: {

            },
            selModel: Ext.create('Ext.selection.CheckboxModel', {
                allowDeselect: true
            }),
            dockedItems: [
                {
                    xtype: 'pagingtoolbar',
                    width: 360,
                    displayInfo: true,
                    dock: 'bottom'
                },
                {
                    xtype: 'toolbar',
                    dock: 'top',
                    items: [
                        {
                            xtype: 'splitbutton',
                            text:'基本操作',
                            menu: {
                                xtype: 'menu',
                                width: 120,
                                items: [
                                    {
										xtype:'menuitem',
                                        text: '新增角色',
										action:'addrole'
                                    },
                                    {
										xtype:'menuitem',
                                        text: '更新角色',
										action:'updaterole'
                                    },
                                    {
										xtype:'menuitem',
                                        text: '删除角色',
										action:'deleteroles'
                                    }
                                ]
                            }
                        },
                        {
                            xtype: 'splitbutton',
                            text:'授权操作',
                            menu: {
                                xtype: 'menu',
                                width: 120,
                                items: [
                                    {
										xtype:'menuitem',
                                        text: '模块功能授权',
										action:'modulefunauth'
                                    }
                                ]
                            }
                        },'-',
						{
                			width: 350,
                			fieldLabel: '简单名称查询',
                			labelWidth: 95,
                			xtype: 'searchfield',
							store:me.store
            			}						
                    ]
                }
            ]
        });

        me.callParent(arguments);
    },
	
	bindStore:function(store) {
		var me = this;
		
		var pagingbar = me.down('pagingtoolbar');
		pagingbar.bindStore(store);
		
		var searchField = me.down('searchfield');
		searchField.bindStore(store);
		me.callParent(arguments);			
	}
});